import { createRouter, createWebHistory} from 'vue-router'
import Home from '../components/Home'
import Problem from '../components/Problem'
import Competition from "@/components/Competition";
import Status from "@/components/Status";
import Login from "@/components/Login";
import Logout from "@/components/Logout";
import ProblemDetail from "@/components/ProblemDetail";
import CompetitionDetail from "@/components/CompetitionDetail";
import User from "@/components/User";
import AddProblem from "@/components/AddProblem";
import AddCompetition from "@/components/AddCompetition";

const routes = [
    {
      path: '/',
      component: Home,
      meta:
      {
          Default: true,
          requireAuth: false
      }
    },
    {
      path: '/Problem',
      component: Problem,
      meta:
      {
          Default: true,
          requireAuth: false
      }
    },
    {
      path: '/ProblemDetail',
      component: ProblemDetail,
      meta:
      {
          Default: false,
          ReadOnly: false,
          requireAuth: true,
          addSubmit: false
      }
    },
    {
      path: '/Competition',
      component: Competition,
      meta:
      {
          Default: true,
          requireAuth: false
      }
    },
    {
        path: '/CompetitionDetail',
        component: CompetitionDetail,
        meta:
            {
                Default: true,
                requireAuth: true,
                addSubmit: true
            }
    },
    {
      path: '/Status',
      component: Status,
      meta:
      {
           Default: true,
           requireAuth: false
      }
    },
    {
      path: '/Login2',
      component: Login,
      meta:
      {
          Default: true,
          flag: false,
          requireAuth: false
      },
    },
    {
        path: '/Login1',
        component: Login,
        meta:
        {
            Default: true,
            flag: true,
            requireAuth: false
        },
    },
    {
      path: '/User',
      component: User,
      meta:
      {
          Default: true,
          requireAuth: false
      }
    },
    {
        path: '/Logout',
        component: Logout,
        meta:
        {
           Default: true,
           requireAuth: false
        }
    },
    {
         path: '/AddProblem',
         component: AddProblem,
         meta:
         {
            Default: true,
            requireAuth: true
         }
    },
    {
        path: '/AddCompetition',
        component: AddCompetition,
        meta:
        {
            Default: true,
            requireAuth: true
        }
    }
]

const router = createRouter({
    // 4. 内部提供了 history 模式的实现。为了简单起见，我们在这里使用 hash 模式。
    history: createWebHistory(process.env.BASE_URL),
    routes: routes // `routes: routes` 的缩写
})



export default router
